﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Threading;
using System.Windows.Forms;
using System.Web.Caching;
using System.IO;
using System.Xml;
using System.Runtime.Serialization;
using Contract;
using LikeTry.Logic;
using LikeTryCore;
namespace LikeTry
{

    public partial class AccountManage : System.Web.UI.Page
    {
        
        protected void Page_Load(object sender, EventArgs e)
        {
            var name = Session["UserName"];
            if (name == null)
            {
                Response.Redirect("Logon.aspx");
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            LikeTryCore.LikeTry obj = new LikeTryCore.LikeTry(this.TextBox2.Text);
            obj.KeepOnline();
            var message = "";
            if (!string.IsNullOrEmpty(obj.UserName.Trim()))
            {
                message = obj.UserName;
            }
            this.TextBox1.Text = message;
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            LikeTryCore.LikeTry.AddAccount(new LikeAccount { Name = this.TextBox1.Text, Cookies = this.TextBox2.Text, Id = Guid.NewGuid().ToString() });
            Response.Redirect("Default.aspx");
        }
    }
}